# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kpimtextedit
pkgver=20.04.3
pkgrel=0
pkgdesc="Advanced text editor which provide advanced html feature"
arch="all !armhf"
url="https://api.kde.org/kdepim/kpimtextedit/html"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
depends_dev="qt5-qtbase-dev qt5-qtspeech-dev grantlee-dev kcodecs-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev kemoticons-dev ki18n-dev kiconthemes-dev kio-dev sonnet-dev syntax-highlighting-dev kwidgetsaddons-dev kxmlgui-dev"
makedepends="$depends_dev extra-cmake-modules qt5-qttools-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/kpimtextedit-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_DESIGNERPLUGIN=ON
	cmake --build build
}

check() {
	cd build

	# kpimtextedit-plaintext-textgotolinewidgettest requires OpenGL
	# kpimtextedit-texttospeech-texttospeechwidgettest requires texttospeech
	# kpimtextedit-texttospeech-texttospeechactionstest is broken
	# kpimtextedit-composerng-richtextcomposertest requires OpenGL
	# kpimtextedit-composerng-richtextcomposercontrolertest requires OpenGL
	# kpimtextedit-grantleebuilder-texthtmlbuildertest is broken
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "kpimtextedit-(plaintext-textgotolinewidget|texttospeech-texttospeechwidget|texttospeech-texttospeechactions|composerng-richtextcomposer|composerng-richtextcomposercontroler|grantleebuilder-texthtmlbuilder)test"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="0d7e0d84d9c25dbeb28413350e7f17f45c643e5335cd26fac28fb5e4e2bc2797d223f9137cbfc2f9fe2f13806ab321ba2a058b7dc40c02762707170285336abe  kpimtextedit-20.04.3.tar.xz"
